<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/Inbox for the canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Inbox\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class InboxController extends AbstractActionController
{
	
	protected $inboxTable;
	
    public function indexAction()
    {
    	
    	$uri = $this->getRequest()->getUri();
    	$scheme = $uri->getScheme();
    	$host = $uri->getHost();
    	$base = sprintf('%s://%s', $scheme, $host);
    	
    	    }

    public function fooAction()
    {
          // This shows the :controller and :action parameters in default route
        // are working when you browse to /product/product/foo
        return array();
    }
	
	 public function createAction()
    {
		
    }
	
	 public function createcatalogAction(){
	 }
	 public function categoryAction(){
	 }
	 public function createcategoryAction(){
	 }
	 
	 public function cobaAction(){
	 
	 	$form = new InboxForm();
	 	$form->get('submit')->setValue('Save');
	 	$request = $this->getRequest();
	 
	 	if($request->isPost())
	 	{
	 		$inbox = new Inbox();
	 		$form->setInputFilter($inbox->getInputFilter());
	 		$form->setData($request->getPost());
	 			
	 		if($form->isValid())
	 		{
	 			echo 'valid';
	 			$inbox->exchangeArray($form->getData());
	 			$this->getInboxTables()->saveInbox($inbox);
	 		}
	 		echo $inbox->getName();
	 		$testing = $form->getData();
	 		echo $testing['name'];
	 
	 	}return array('form' => $form);
	 
	 }
	 public function getInboxTable()
    {
        if (!$this->inboxTable) {
            $sm = $this->getServiceLocator();
            $this->inboxTable = $sm->get('Inbox\Model\InboxTable');
        }
        return $this->inboxTable;
    }
}
